//
//  TelBookDataSource.swift
//  telephoneBook
//
//  Created by cyptt on 2023/6/18.
//

import UIKit
import CHSimpleUI

class CHPDFDataSource: CHBaseColDataSource ,UICollectionViewDataSource  {
    
    override init(identifier: String, successCallBack: dataColSourceSuccessBlock? = nil) {
        super.init(identifier: identifier,successCallBack: successCallBack)
    }
    
  
 
    func numberOfSections(in collectionView: UICollectionView) -> Int {
        return 1
    }
    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return self.datas.count
    }
    
    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        if #available(iOS 11.0, *) {
            var cell:CHPDFColCell? = collectionView.dequeueReusableCell(withReuseIdentifier: self.identifier, for: indexPath) as? CHPDFColCell
            if cell == nil{

                cell = CHPDFColCell()
            }
            if self.successCallBack != nil {
                self.successCallBack!(cell!,self.datas[indexPath.row],indexPath,collectionView)
            }
            return cell!
        } else {
           
            return UICollectionViewCell()
        }
     
    
        
  
    }
    
    
}


